package com.zrrd.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zrrd.entity.Teacher;
import com.zrrd.service.TeacherService;
import com.zrrd.utils.ResponseResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ZhangYK
 * @version 8.0
 * @title TeacherCopntroller
 * @description
 * @create 2024/3/30 20:47
 */
@RestController
@RequestMapping("/teachers")
public class TeacherCopntroller {
    @Resource
    TeacherService teacherService;

    @GetMapping
    @ResponseBody
    public ResponseResult queryAll(){
        List<Teacher> list = teacherService.list();
        return ResponseResult.queryResponse(list);
    }

    @GetMapping("/queryPassword")
    @ResponseBody
    public ResponseResult queryPassword(){
        QueryWrapper qw = new QueryWrapper();
        qw.select("password");
        List<Teacher> list = teacherService.list(qw);
        return ResponseResult.queryResponse(list);
    }
}
